package com.wanmait.employment.manageController;


import com.github.pagehelper.PageInfo;
import com.wanmait.employment.entity.Nation;
import com.wanmait.employment.service.NationService;
import com.wanmait.employment.util.AjaxResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("manage/Nation")
public class NationController {
  @Resource
    private NationService nationService;
 @GetMapping("list")
    public AjaxResult list(String title,Integer pageNum, Integer pageSize){
     PageInfo<Nation> nationPageInfo = nationService.selectList( title,pageNum,pageSize);
     return AjaxResult.success(nationPageInfo);
 }
 @PostMapping("update")
    public AjaxResult update(@RequestBody Nation nation){
     if(nation.getId()!=null) {
         nationService.update(nation);
         return AjaxResult.success("成功");
     }
     nationService.insert(nation);
     return AjaxResult.success("成功");
 }
 @GetMapping("delete")
    public void delete(Integer id){
     nationService.delete(id);
 }
}
